package com.nuoniu.sibanyun.controller.crm.call;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.crm.call.dto.CrmCallBaseSettingInfoSearchDto;
import com.nuoniu.sibanyun.entity.crm.call.dto.CrmCallBillDto;
import com.nuoniu.sibanyun.service.crm.call.ICrmCallBillService;
import com.nuoniu.sibanyun.userThread.UserInfo;
import com.nuoniu.sibanyun.userThread.UserThreadLocal;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 客户管理-外呼账单 前端控制器
 * </p>
 *
 * @author 小啊刚
 * @since 2022-05-06
 */
@RestController
@RequestMapping("/crm/callBill")
@Api(value="外呼账单 ",tags={"外呼账单"})
public class CrmCallBillController extends BaseController {

    @Autowired
    private ICrmCallBillService crmCallBillService;

    @PostMapping("pageList")
    @ApiOperation(value = "分页查询外呼账单")
    public HttpResult pageAgentStatisticsBySystem(@RequestBody CrmCallBillDto crmCallBillDto) {
        return HttpResult.ok(crmCallBillService.pageList(crmCallBillDto));
    }

    @GetMapping("getCurrentBillByCompany")
    @ApiOperation(value = "获取当月账单")
    public HttpResult getCurrentBillByCompany() {
        UserInfo userInfo = UserThreadLocal.get();
        return HttpResult.ok(crmCallBillService.getCurrentBillByCompany(userInfo.getCompanyId()));
    }

}
